#include "mainbom.h"
#include "ui_mainbom.h"
#include "mypushbutton.h"
#include "play.h"
#include <QDebug>
#include <QPainter>
#include "game.h"
#include<QFile>
#include<QKeyEvent>
#include<QMessageBox>
Mainbom::Mainbom(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::Mainbom)//,game(":/maps/level0.txt")
{
    ui->setupUi(this);
    p = new Play;
    //g =new Game;
    setFixedSize(1017,646);
    setWindowIcon(QIcon(":/res/game_begin.png"));
    setWindowTitle("炸弹人");
    MyPushButton *startBtn = new MyPushButton (":/res/IMG_1586.PNG");
    startBtn->setParent(this);
    startBtn->move(430,410);
    connect(startBtn,&QPushButton::clicked,p,[=](){
            this->hide();
            p->show();
            //g->show();
//        QPainter painter(this);
//        game.draw(painter);
    });
}
void Mainbom::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/res/game_begin.png");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);
    //QPainter painter(p);
    //game.draw(painter);
}

Mainbom::~Mainbom()
{
    delete ui;
}

